#include "base/StoreRequest.h"
#include "util/Logger.h"

NEW_DELETE_OPERATORS_CPP(StoreRequest,10000);

StoreRequest::StoreRequest (const StoreRequest& sr) :
    DataRequest(sr.getAddress(), 
                sr.getProcessor(), 
                sr.getSource(),
                sr.getDestination(),
                sr.getDataSize(),
                sr.getSize() - sr.getDataSize()),
    wbtype(sr.getWritebackType())
{
    memcpy(data, sr.getData(), sr.getDataSize());
}

const char* StoreRequest::toString () {
    char tmp[512];
    strcpy(tmp, Request::toString());
    sim_sprintf(string, "%s(ST)[%08llx]%s%s", 
                tmp, 
                getAddress(),
                isUncached() ? " (uncached)" : "",
                getWritebackType() == WB_EVICTION ? " (eviction)" : "");

    return string;
}

WritebackType StoreRequest::getWritebackType () const {
    return wbtype;
}

void StoreRequest::setWritebackType (WritebackType wt) {
    wbtype = wt;
}

bool StoreRequest::isLoaded () {
    return loaded;
}

void StoreRequest::setLoaded (bool _b) {
    loaded = _b;
}
